# Maintainer: Ray Donnelly <mingw.android@gmail.com>

_realname=ideviceinstaller
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.1.1
pkgrel=1
pkgdesc='Manage apps of iOS devices (mingw-w64)'
arch=('any')
url='https://www.libimobiledevice.org/'
license=('GPL2+')
source=("${_realname}-${pkgver}.tar.gz"::https://github.com/libimobiledevice/ideviceinstaller/archive/${pkgver}.tar.gz)
depends=("${MINGW_PACKAGE_PREFIX}-libplist"
         "${MINGW_PACKAGE_PREFIX}-libimobiledevice"
         "${MINGW_PACKAGE_PREFIX}-libzip")
sha256sums=('b1401678a61f28c4aca95375c100b5a83ccc2cdfa0222c0de7ad0a2cfb4e3c9f')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}

  NOCONFIGURE=1 ./autogen.sh
}

build() {
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}

  ../${_realname}-${pkgver}/configure \
      --prefix=${MINGW_PREFIX} \
      --build=${MINGW_CHOST} \
      --host=${MINGW_CHOST} \
      --target=${MINGW_CHOST} \
      --enable-static \
      --enable-shared

  make
}

check() {
  cd "${srcdir}"/build-${CARCH}
  make check
}

package() {
  cd "${srcdir}"/build-${CARCH}
  make install DESTDIR="${pkgdir}"
}
